<%@page language="java" contentType="text/html; charset=utf-8"%>
<%@include file="/tagDeclare.jsp"%>
<%@include file="/headDeclare.jsp"%>
<%response.setHeader("cache-control","public"); %>
<html>
 <head>
<style type="text/css"> 
	fieldset,table,tr,td {margin:0; padding:0;}
	td {padding:0 5px 0 10px;border:1px;}
	form label {font-weight:bold;}
	table{border-collapse: collapse;}
  </style>

  <script type="text/javascript">
	$(document).ready(function() { 
		
        $("#btn_insert").click(function(){
            var queryString = $("#rightForm").formSerialize();
            queryString = encodeURIComponent(queryString);
            location.href = "<%=basePath%>right/insert.do?qs=" + queryString;
        });
        
        $("#btn_search").click(function(){
            $("#curPage").val(1);
            $("#rightForm").submit();
        });
        
        //批量删除
        $("#btn_batch_del").click(function(){
        	var queryString = $("#rightForm").formSerialize();
            queryString = encodeURIComponent(queryString);
        	var ids = null;
        	$("input[name='checkName']:checkbox:checked").each(function(){ 
        		if(ids == null)
        			ids = $(this).val();
        		else
        		    ids +=","+$(this).val() ;
        	}) ;
        	if(ids ==null)return;
        	if(ids == "")
        		{
        			alert("请选择");
        			return;
        		}
        	location.href = "<%=basePath%>right/batchDelete.do?ids=" + ids +"&qs=" + queryString;
        });
        
        $("#btn_change").click(function(){
            var page = parseInt($("#selectPage").val());
            var curPage = parseInt($("#curPage").val());
            if(curPage == page) return;
            $("#curPage").val(parseInt(page));
            $("#rightForm").submit();
        });
      
	}); 
  </script>
 </head>

 <body>
 
 <div style="width: 100%;">
  <div style="margin: auto;">
      <form id="rightForm"  method="post" action="right/list.do">
        <table>
          <tr>
            <td><label for="name">权限名称:</label></td>
            <td><input type="text" name="rightname" id="rightname" value="${rightname }" style="width:120px;" /></td>
            <td><input type="submit" id="btn_search" name="btn_search" value="查询" style="width:80px;" /></td>
          </tr>
        </table>
      </form>
  </div>
  <hr />
  <div>
  	<table id="rightTable" class="tablesorter">
	    <tr>
          <th style="text-align: center;">权限名称</th>
          <th style="text-align: center;">权限标识</th>
          <th style="text-align: center;">权限URL</th>
          <th style="text-align: center;">父权限</th>
          <th style="text-align: center;">操作</th>
 	    </tr> 
	  	<c:forEach items="${list}" var="right" varStatus="status">
	  	<tr>
	  	  <td style="word-wrap: break-word; word-break:break-all;text-align: center;">
	  	  	${right.rightName }
	  	  </td>
	  	  <td style="word-wrap: break-word; word-break:break-all;text-align: center;">${right.rightMark }</td>
	  	  <td style="word-wrap: break-word; word-break:break-all;text-align: center;">
			${right.rightUrl }
		  </td>
		  <td style="word-wrap: break-word; word-break:break-all;text-align: center;">
			${right.upRightId }
		  </td>
	  	  <td style="text-align: center;" >
	  	  	<a href="right/view.do?id=${right.id }">查看</a>
  	  		<a href="right/update.do?id=${right.id }">修改</a>
  	  		<a href="right/delete.do?id=${right.id }">删除</a>
	  	  </td>
	  	</tr>
	  	</c:forEach>
  	</table>
  </div>
	<hr />
  <div>
  <div style="float: left;">
  	 <input type="button" id="btn_batch_del" name="btn_batch_del" value="批量删除" style="width:80px;" />
  	 <input type="button" id="btn_insert" name="btn_insert" value="新增" style="width:80px;" />
  </div>
      <div style="text-align:right;">
      <form action="wall/list.do" id="pagerForm" name="pagerForm" >
       	<jt:pager action="pagerForm"></jt:pager>
       </form>
      </div>
  </div>
 </div>
 </body>
</html>

